home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJEMU106.ARJ / E63.CC < prev    next >
C/C++ Source or Header  |  1991-04-25  |  1KB  |  82 lines

  1. #include "emu.h"
  2. #include "rmov.h"
  3. #include "compare.h"
  4.  
  5. void emu_63()
  6. {
  7.   if (empty())
  8.     return;
  9.   if (modrm > 0277)
  10.   {
  11.     // fcompp
  12.     if ((modrm&7) != 1)
  13.       return emu_bad();
  14.     if (empty(1))
  15.     {
  16.       setcc(SW_C3|SW_C2|SW_C0);
  17.       return;
  18.     }
  19.     int c = compare(st(), st(1));
  20.     int f;
  21.     st().tag = TW_E;
  22.     top++;
  23.     st().tag = TW_E;
  24.     top++;
  25.     if (c & COMP_NAN)
  26.     {
  27.       exception(EX_I);
  28.       f = SW_C3 | SW_C2 | SW_C0;
  29.     }
  30.     else
  31.       switch (c)
  32.       {
  33.         case COMP_A_LT_B:
  34.           f = SW_C0;
  35.           break;
  36.         case COMP_A_EQ_B:
  37.           f = SW_C3;
  38.           break;
  39.         case COMP_A_GT_B:
  40.           f = 0;
  41.           break;
  42.         case COMP_NOCOMP:
  43.           f = SW_C3 | SW_C2 | SW_C0;
  44.           break;
  45.       }
  46.     setcc(f);
  47.     
  48.   }
  49.   else
  50.   {
  51.     // ficomp m16int
  52.     reg t;
  53.     r_mov((short *)get_modrm(), t);
  54.     int c = compare(st(), t);
  55.     st().tag = TW_E;
  56.     top++;
  57.     int f;
  58.     if (c & COMP_NAN)
  59.     {
  60.       exception(EX_I);
  61.       f = SW_C3 | SW_C2 | SW_C0;
  62.     }
  63.     else
  64.       switch (c)
  65.       {
  66.         case COMP_A_LT_B:
  67.           f = SW_C0;
  68.           break;
  69.         case COMP_A_EQ_B:
  70.           f = SW_C3;
  71.           break;
  72.         case COMP_A_GT_B:
  73.           f = 0;
  74.           break;
  75.         case COMP_NOCOMP:
  76.           f = SW_C3 | SW_C2 | SW_C0;
  77.           break;
  78.       }
  79.     setcc(f);
  80.   }
  81. }
  82.